/**
 * 熊猫直播间初始化
 * @param page
 * @param sleep
 * @returns {Promise<void>}
 */
module.exports = async ({page, sleep}) => {
    await page.addStyleTag({
        content: `
        div#main_header,
        .room_w-room_ban,
        .room_w-malllist,
        .room_w-room_gala,
        .room_w-svga_wrap,
        .room_w-boxticket,
        .room_w-lucky-gift-animate,
        .room_w-chat_animation,
        .room_w-giftbar,
        .room_w-lottery_animate_wrap,
        .room_w-guess_guide,
        .room_w-guess_guide2,
        .qmtv-player_login-guide-wrap,
        .room_w-lottery_poplottery
            {display: none !important;}
            
        div#main-container > div:nth-child(n+4) {display: none !important;}       
        `
    });
    await sleep(5000);
    await page.evaluate(() => {
        const $html = document.querySelector('html');
        if ($html.className.indexOf('main__sidebar-mini') === -1)
            document.querySelector('.common_w-sidebar-ctrl').click();

        const $player = document.querySelector('div.room_w-title');
        if ($player)
            window.scrollTo(0, $player.getBoundingClientRect().y);
    });
};